package com.cjm.one.webmanager.service.customer.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.custom.client.CustomerInfoClient;
import com.cjm.one.model.custom.dto.UserChartItem;
import com.cjm.one.model.custom.entity.CustomerInfo;
import com.cjm.one.webmanager.service.customer.CustomerInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CustomerInfoServiceImpl implements CustomerInfoService {
    @Resource
    private CustomerInfoClient customerInfoClient;

    @Override
    public Page<CustomerInfo> getList(Integer current, Integer size, String name, String phone, Long userId, String level,String email) {
        return customerInfoClient.list(current, size, name, phone,email, userId, level).getData();
    }

    @Override
    public CustomerInfo getById(Long id) {
        return customerInfoClient.getInfo(id).getData();
    }

    @Override
    public Boolean removeById(Long id) {
        return customerInfoClient.deleteInfo(id).getData();
    }

    @Override
    public Boolean updateById(CustomerInfo customerInfo) {
        return customerInfoClient.updateInfo(customerInfo).getData();
    }

    @Override
    public Boolean addInfo(CustomerInfo customerInfo) {
        return customerInfoClient.addInfo(customerInfo).getData();
    }

    @Override
    public Map<String, Object> getUserSummary(String timeRange) {
        return customerInfoClient.getUserSummary(timeRange).getData();
    }

    @Override
    public List<UserChartItem> getUserChart(String timeRange) {
        return customerInfoClient.getUserChart(timeRange).getData();
    }

    @Override
    public Boolean refund(String orderNo) {
        return customerInfoClient.refund(orderNo).getData();
    }
}
